home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
JCSM Shareware Collection 1996 September
/
JCSM Shareware Collection (JCS Distribution) (September 1996).ISO
/
tutorial
/
trac.zip
/
FIGIV-1.TRA
< prev
next >
Wrap
Text File
|
1990-01-25
|
3KB
|
54 lines
0009 0 Origin
STRT RD X Read X (Also sets next 4 locations to zero)
LD X Load accumulator with X
BZSTOP If X is zero jump to halt instruction
BN*+4 If X is negative, skip next 3 instructions
LD ONE Load +1
ST S Store at S (sign)
BU*+6 Branch unconditionally around next 5
LDNEG1 Load -1
ST S Store at S
LDZERO Load zero
SU X Subtract X (This makes a negative X positive)
ST X Store back at X
LD ONE Load 1
ST I I=1 using index register 2
LD X Load X
SR0008 Shift it right 8
ST Y Store at Y
LOOP LD Y Load Y (Note this is the start of a loop)
MU ATE Multiply by 8
ST Y Store at Y
LD X Load X
2SL0000 Shift left by I (Contents of register 2)
SR0008 Shift right 8 (This isolates an octal digit)
AD Y Add previous Y
ST Y Store back at Y
LD I Load I
AD ONE Add 1
ST I Store at I
SUNINE Subtract 9 to see if done
BNLOOP If negative repeat loop
LD X Load X
MU S Multiply by sign
ST X Store at X
LD Y Load Y
MU S Multiply by sign
ST Y Store at Y
PC X Print X, Y
BUSTRT Branch back to start
STOP HT0000 Halt
0001 0 Re-origin to define I
I 0
1499 0 Re-origin for constants
ZERO 0 Zero
ONE 1 One
S 0
NEG1 -1 Negative one
ATE 8 Eight
NINE 9 Nine
0999 0 Re-origin for read area
X 0
Y 0
ENSTRT End of code and starting location